package ar.edu.unq.tpi.uis.tepe3.dominio;

import java.io.Serializable;

/**
 * @author gpilla <gpilla@unq.edu.ar>
 *
 */
public class Access implements Serializable{
	
	private Grantable who;
	private Privilege how;

	/**
	 * Constructor que recibe un Grantable y un Privilegio
	 * @param aGranteable
	 * @param aPrivilege
	 */
	public Access(Grantable aGranteable, Privilege aPrivilege) {
		setWho(aGranteable);
		setHow(aPrivilege);
	}

	/**
	 * Constructor pelado.
	 */
	public Access() {
		setWho(new Grantable("") {
			
		});
		setHow(Privilege.DoNothing);
	}

	/**
	 * @param who
	 */
	public void setWho(Grantable who) {
		this.who = who;
	}

	/**
	 * @return
	 */
	public Grantable getWho() {
		return who;
	}

	/**
	 * @param how
	 */
	public void setHow(Privilege how) {
		this.how = how;
	}

	/**
	 * @return
	 */
	public Privilege getHow() {
		return how;
	}
	
	
	/* (non-Javadoc)
	 * @see java.lang.Object#toString()
	 */
	@Override
	public String toString() {
		// TODO Auto-generated method stub
		return getWho() + " - " + getHow();
	}
	
	public Access createNewUserAccess(){
		return this;
	}
	
	public Access createNewGroupAccess(){
		return this;
	}
}
